Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

160
Views
Running "python -m unittest" failing with maven exec-maven-plugin

I am trying to configure my maven build so that mvn test runs my python tests in addition to my java tests. I am trying to use the exec-maven-plugin to do this.

My pom.xml has:

 <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>3.0.0</version> <executions> <execution> <configuration> <executable>python3</executable> <workingDirectory>${project.basedir}/src/main/resources/scripts/</workingDirectory> <arguments> <argument>-m</argument> <argument>unittest</argument> <argument>discover</argument> <argument>-p</argument> <argument>'*_test.py'</argument> </arguments> </configuration> <id>python-test</id> <phase>test</phase> <goals> <goal>exec</goal> </goals> </execution> </executions> </plugin>

My project structure is like:

 . ├── pom.xml ├── src │   ├── main │   │   └── resources │   │   ├── scripts │   │   │   ├── __init__.py │   │   │   ├── foo.py │   │   │   ├── foo_test.py

When I try to run it from the root of the project:

 mvn exec:exec@python-test

I get 0 tests executed:

 ---------------------------------------------------------------------- Ran 0 tests in 0.000s OK

But, if I do this manually, it works fine:

 cd src/main/resources/scripts python3 -m unittest discover -p '*_test.py' ... ---------------------------------------------------------------------- Ran 3 tests in 0.010s

What am I doing wrong here?

Thanks in advance!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Turns out the single quotes on this line were the problem: <argument>'*_test.py'</argument> . The single quotes around the file -p "'*_test.py'" and did not match any files. Removing them fixed the problem.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!